import request from '@/router/axios';
import {downloadExcel} from '@/router/axios';
import {formatCondition} from '@/util/util';
//单条查询
export const queryGeneralScheduleInfo = (params) => {
  params.head.transCode = 'queryGeneralScheduleInfo';
  return request({
    url: '/general/generalScheduleInfo/queryGeneralScheduleInfo',
    method: 'post',
    data: params
  })
}
//多条列表查询，支持条件查询
export const queryGeneralScheduleInfoListPage = (params) => {
  params.head.transCode = 'queryGeneralScheduleInfoListPage';
  return request({
    url: '/general/generalScheduleInfo/queryGeneralScheduleInfoListPage',
    method: 'post',
    data: params
  })
}
//新增单条记录
export const saveGeneralScheduleInfo = (params) => {
  params.head.transCode = 'saveGeneralScheduleInfo';
  return request({
    url: '/general/generalScheduleInfo/saveGeneralScheduleInfo',
    method: 'post',
    data: params
  })
}
//新增多条记录
export const saveGeneralScheduleInfoList = (params) => {
  params.head.transCode = 'saveGeneralScheduleInfoList';
  return request({
    url: '/general/generalScheduleInfo/saveGeneralScheduleInfoList',
    method: 'post',
    data: params
  })
}
//新增或修改单条记录
export const saveOrUpdateGeneralScheduleInfo = (params) => {
  params.head.transCode = 'saveOrUpdateGeneralScheduleInfo';
  return request({
    url: '/general/generalScheduleInfo/saveOrUpdateGeneralScheduleInfo',
    method: 'post',
    data: params
  })
}


//新增或修改单条记录
export const saveOrUpdateGeneralScheduleInfoList = (params) => {
  params.head.transCode = 'saveOrUpdateGeneralScheduleInfoList';
  return request({
    url: '/general/generalScheduleInfo/saveOrUpdateGeneralScheduleInfoList',
    method: 'post',
    data: params
  })
}

//修改单条记录
export const updateGeneralScheduleInfo = (params) => {
  params.head.transCode = 'updateGeneralScheduleInfo';
  return request({
    url: '/general/generalScheduleInfo/updateGeneralScheduleInfo',
    method: 'post',
    data: params
  })
}

//删除单条记录
export const deleteGeneralScheduleInfo = (params) => {
  params.head.transCode = 'deleteGeneralScheduleInfo';
  return request({
    url: '/general/generalScheduleInfo/deleteGeneralScheduleInfo',
    method: 'post',
    data: params
  })
}

//删除多条记录
export const deleteGeneralScheduleInfoList = (params) => {
  params.head.transCode = 'deleteGeneralScheduleInfoList';
  return request({
    url: '/general/generalScheduleInfo/deleteGeneralScheduleInfoList',
    method: 'post',
    data: params
  })
}
//导出excel
export const exportGeneralScheduleInfoExcel = (params) => {
  downloadExcel({
    url: '/general/generalScheduleInfo/excelDownload/exportGeneralScheduleInfoExcel',
    method: 'get',
    data: 
    {
      tenantId: params.head.tenantId,
      orders:'',
      condition: formatCondition(params.body.sqlCondition)
    }
  })
}
//查询时间段内的日程信息
export const queryScheduleDuration = (params) => {
  params.head.transCode = 'queryScheduleDuration';
  return request({
    url: '/general/generalScheduleInfo/queryScheduleDuration',
    method: 'post',
    data: params
  })
}